// 在定时器回调函数中指定参数。
#include <muduo/net/EventLoop.h>
#include <boost/bind.hpp>
#include <iostream>

using namespace muduo::net;
using namespace std;

void 
Print(EventLoop *loop, int *count) {
	if (*count < 5) {
		cout << "******* " << *count << endl;
		++(*count);
		loop->runAfter(1, boost::bind(Print, loop, count));
	} else {
		loop->quit();
	}
}

int 
main() {
	EventLoop loop;
	int count = 0;
	loop.runAfter(1, boost::bind(Print, &loop, &count)); // use loop.runEvery instead
	loop.loop();
	cout << "final count is " << count << endl;
	return 0;
}